#ifndef __INETADDRESS_H__
#define __INETADDRESS_H__
#include <netinet/in.h>
#include <string>

using std::string;
class InetAddress
{
public:
    explicit InetAddress(uint16_t port = 0, bool loopBackOnly = false);
    InetAddress(const string &ip, uint16_t port);
    explicit InetAddress(const struct sockaddr_in addr)
    : _addr(addr) {}

    string ip() const;
    uint16_t port() const;
    const struct sockaddr *getAddrPtr() const;
    struct sockaddr_in *getAddrinPtr();

private:
    struct sockaddr_in _addr;
};

#endif
